<template>
  <div class="menu">
    <el-menu
      :default-active="activeIndex"
      @select="handleSelect"
      background-color="#545c64"
      text-color="#fff"
      active-text-color="#ffd04b">
      <el-menu-item index="/home">系统主页</el-menu-item>
      <el-menu-item index="subjectIntroduction">学科简介</el-menu-item>
      <el-submenu index="/aggregatePage">
        <template slot="title">集结页面</template>
        <el-menu-item index="/aggregatePage/single">单算子分析</el-menu-item>
        <el-menu-item index="/aggregatePage/multiple">多算子比较</el-menu-item>
        <el-menu-item index="/aggregatePage/direct">直接集结</el-menu-item>
      </el-submenu>
      <el-menu-item index="/developmentEvent">发展事件</el-menu-item>
      <el-menu-item index="5">成果展示</el-menu-item>
      <el-menu-item index="6">社区交流</el-menu-item>
    </el-menu>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        activeIndex: '/home'
      };
    },
    mounted() {
      let Index = JSON.parse(sessionStorage.getItem('Index'))
      this.activeIndex = Index.activeIndex
    },
    methods: {
      handleSelect(key, keyPath) {
        sessionStorage.setItem('Index', JSON.stringify({activeIndex: keyPath[keyPath.length - 1]}));
        this.$router.push(keyPath[keyPath.length - 1])
      }
    }
  }
</script>

<style>
.menu{
    width: 100%;
    height: 100%;
    background-color: #545c64;
}
</style>